package com.uzai.console.dto.locallive.elmtoken;

import com.uzai.console.common.utils.DateUtil;
import com.uzai.console.dto.QueryParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;

/**
 * @Auther: liuqi
 * @Date: 2021/8/10 14:58
 * @Description:
 */
@ApiModel("饿了么联盟分页查询参数")
public class ElmTokenQuery extends QueryParam {

    @ApiModelProperty("联盟账号")
    private String userName;

    @ApiModelProperty(value = "类型：0淘宝，1饿了么", hidden = true)
    private Integer type;

    @ApiModelProperty("查询类型(0-查询已经到期；1-查询未到期；2-查询即将到期（7天内)；3-查询即将到期（15天内)；4-查询即将到期（30天内)")
    private Integer expireType;

    @ApiModelProperty(value = "查询开始到期时间", hidden = true)
    private Integer expireTimeStart;

    @ApiModelProperty(value = "查询开始到期时间", hidden = true)
    private Integer expireTimeEnd;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getExpireType() {
        return expireType;
    }

    public void setExpireType(Integer expireType) {
        this.expireType = expireType;
    }

    public Integer getExpireTimeStart() {
        if(expireType != null) {
            if (expireTimeStart == null) {
                expireTimeStart = DateUtil.getNowTime();
            }
        }
        return expireTimeStart;
    }

    public void setExpireTimeStart(Integer expireTimeStart) {
        this.expireTimeStart = expireTimeStart;
    }

    public Integer getExpireTimeEnd() {
        if(expireType != null){
            if(expireType.intValue() == 0){
                expireTimeEnd = getExpireTimeStart();
            }else if(expireType.intValue() == 1){
                expireTimeEnd = getExpireTimeStart();
            }else if (expireType.intValue() == 2){
                expireTimeEnd = getExpireTimeStart() + 604800;
            }else if (expireType.intValue() == 3){
                expireTimeEnd = getExpireTimeStart() + 1296000;
            }else if (expireType.intValue() == 4){
                expireTimeEnd = getExpireTimeStart() + 2592000;
            }
        }
        return expireTimeEnd;
    }

    public void setExpireTimeEnd(Integer expireTimeEnd) {
        this.expireTimeEnd = expireTimeEnd;
    }
}
